package edu.nf.dbutil.result;

import edu.nf.dbutil.RowProcessor;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * 将一条数据转换成实体对象
 * @author yang
 * @date 2024-05-10
 */
public class BeanListHandler<T> extends AbstractListHandler<T>{
    private Class<T> beanClass;

    public BeanListHandler(Class<T> beanClass) {
        this.beanClass = beanClass;
    }

    @Override
    public T handleRow(ResultSet rs) throws SQLException {
        return RowProcessor.toBean2(rs, beanClass);
    }
}
